/* general */
html {
  height: 100%;
}
body {
  background-image: url(chrome://ntab/skin/noise.png);
  background-attachment: fixed;
  color: #3c3c3c;
  font-family: Microsoft YaHei, Simsum, serif;
  font-size: small;
  height: 100%;
  margin: 0 auto;
  min-height: 510px;
}
body,
footer {
  min-width: 960px;
}
body.nav,
body.search {
  overflow-y: hidden;
}
ol, ul {
  margin: 0;
  padding: 0;
}
:-moz-focusring {
  outline: 0;
}

/* top controls */
#setdefault, #navpane {
  position: absolute;
  top: 20px;
}
#setdefault {
  background-image: -moz-linear-gradient(top, #f1a84a, #db6e18);
  background-image: linear-gradient(to bottom, #f1a84a, #db6e18);
  border: 1px solid #db6e15;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px #f7ca7f;
  color: white;
  cursor: pointer;
  display: block;
  left: -moz-calc(100% * (50 / 960) + 20px);
  padding: 2px 4px;
  text-align: center;
  -moz-border-radius: 2px;
  -moz-box-shadow: inset 0 0 0 1px #f7ca7f;
}
#setdefault[hidden="true"] {
  display: none;
}
#setdefault:hover {
  background-image: -moz-linear-gradient(top, #db6e18, #f1a84a);
  background-image: linear-gradient(to bottom, #db6e18, #f1a84a);
}

#navpane {
  right: -moz-calc(100% * (50 / 960) + 20px);
}
#navpane > a {
  background-image: url(chrome://ntab/skin/icon/controls.png);
  cursor: pointer;
  display: inline-block;
  height: 24px;
  text-indent: -9999px;
  width: 24px;
}
#navpane > a[data-pane="nav"] {
  background-position: -89px -30px;
}
#navpane > a[data-pane="quickdial"] {
  background-position: -59px -30px;
}
#navpane > a[data-pane="search"] {
  background-position: -119px -30px;
}
#navpane > a[data-pane="blank"] {
  background-position: -149px -30px;
}
.nav > #navpane > a[data-pane="nav"],
#navpane > a[data-pane="nav"]:active,
#navpane > a[data-pane="nav"]:hover {
  background-position: -89px 0;
}
.quickdial > #navpane > a[data-pane="quickdial"],
#navpane > a[data-pane="quickdial"]:active,
#navpane > a[data-pane="quickdial"]:hover {
  background-position: -59px 0;
}
.search > #navpane > a[data-pane="search"],
#navpane > a[data-pane="search"]:active,
#navpane > a[data-pane="search"]:hover {
  background-position: -119px 0;
}
.blank > #navpane > a[data-pane="blank"],
#navpane > a[data-pane="blank"]:active,
#navpane > a[data-pane="blank"]:hover {
  background-position: -149px 0;
}

/* view switcher */
section, #overlay {
  display: none;
  height: 100%;
  margin: auto;
  width: 100%;
}
.nav > #nav,
.quickdial > #quickdial,
.search > #search,
.blank > #blank {
  display: block;
}
.nav > section#nav {
  height: -moz-calc(100% - 50px);
  margin-top: 35px;
}

section > iframe {
  border: 0;
  height: 100%;
  overflow-x: hidden;
  width: 100%;
}

/* quickdial view */
#quickdial > iframe {
  display: block;
  height: 0;
  margin: auto;
  padding: 50px 0 20px;
  overflow: hidden;
  width: 605px;
}
#quickdial > iframe[src] {
  height: 60px;
}

/* quickdial tab switcher */
#prevtab,
#quick_dial_tabpanels,
#nexttab {
  float: left;
  height: -moz-calc(100% - 80px);
}
#quickdial > iframe[src] ~ #prevtab,
#quickdial > iframe[src] ~ #quick_dial_tabpanels,
#quickdial > iframe[src] ~ #nexttab {
  height: -moz-calc(100% - 130px);
}
#prevtab,
#nexttab {
  display: -moz-box;
  cursor: pointer;
  height: 100%;
  margin-top: -70px;
  width: -moz-calc(100% * (50 / 960));
}
#quickdial > iframe[src] ~ #prevtab,
#quickdial > iframe[src] ~ #nexttab {
  height: 100%;
  margin-top: -130px;
}
#prevtab > .top-flex,
#nexttab > .top-flex {
  height: -moz-calc(50% - 18px);
}
#prevtab > .arrow,
#nexttab > .arrow {
  background-clip: content-box;
  background-image: url(chrome://ntab/skin/icon/arrow.png);
  background-origin: content-box;
  background-repeat: no-repeat;
  height: 36px;
  width: 30px;
}
#prevtab > .arrow {
  background-position: 0 -40px;
  padding-left: -moz-calc(100% - 40px);
  padding-right: 10px;
}
#nexttab > .arrow {
  background-position: -30px -40px;
  padding-left: 10px;
  padding-right: -moz-calc(100% - 40px);
}
#prevtab:hover {
  background: url(chrome://ntab/skin/icon/hover_left.png) no-repeat right center;
}
#nexttab:hover {
  background: url(chrome://ntab/skin/icon/hover_right.png) no-repeat left center;
}
#prevtab:hover > .arrow {
  background-position: 0 0;
}
#nexttab:hover > .arrow {
  background-position: -30px 0;
}
.color > #prevtab:hover {
  background-image: url(chrome://ntab/skin/icon/hover_left_grey.png);
}
.color > #nexttab:hover {
  background-image: url(chrome://ntab/skin/icon/hover_right_grey.png);
}
.color > #prevtab:hover > .arrow {
  background-position: 0 -40px;
}
.color > #nexttab:hover > .arrow {
  background-position: -30px -40px;
}

#prevtab.grid,
#prevtab.grid:hover,
#quick_dial_tabpanels.site + #nexttab,
#quick_dial_tabpanels.site + #nexttab:hover {
  background: transparent;
  cursor: default;
}
#prevtab.grid > .arrow,
#prevtab.grid:hover > .arrow,
#quick_dial_tabpanels.site + #nexttab > .arrow,
#quick_dial_tabpanels.site + #nexttab:hover > .arrow {
  background: transparent;
}

#quick_dial_tabpanels {
  overflow: hidden;
  position: relative;
  width: -moz-calc(100% * (1 - 100 / 960));
}

#quick_dial_tabpanels > div {
  height: 100%;
  left: -100%;
  position: absolute;
  top: 0;
  transition-delay: 0s;
  transition-duration: 400ms;
  transition-property: left;
  transition-timing-function: linear;
  width: 100%;
  -moz-transition-delay: 0s;
  -moz-transition-duration: 400ms;
  -moz-transition-property: left;
  -moz-transition-timing-function: linear;
}
#quick_dial_tabpanels.grid > #grid,
#quick_dial_tabpanels.site > #site {
  left: 0;
}
#quick_dial_tabpanels.grid > #grid ~ div,
#quick_dial_tabpanels.site > #site ~ div {
  left: 100%;
}

/* quickdial grid */
#grid {
  overflow: hidden;
}

#grid > ul {
  background: url(chrome://ntab/skin/icon/fake_scroll.png) no-repeat 0 0;
  display: none;
  list-style-type: none;
  position: fixed;
  right: -moz-calc(100% * 50 / 960 + 10px);
  bottom: 60px;
}
#quick_dial_tabpanels.grid > #grid > ul[data-scroll] {
  display: block;
}
#grid > ul[data-scroll="-1"] {
  background-position: 0 -70px;
}
#grid > ul[data-scroll="1"] {
  background-position: 0 -140px;
}
#grid > ul > li {
  height: 25px;
  text-indent: -9999px;
  width: 30px;
}

#grid > ol {
  list-style: none;
  margin: -10px auto 50px;
  max-width: 1160px;
  overflow: hidden;
  width: -moz-calc(100% - 2 * 40px);
}
footer.off ~ #quickdial > #quick_dial_tabpanels > #grid > ol {
  margin-bottom: 0;
}
#grid > ol > li {
  border: 1px #d8d8d8 solid;
  box-sizing: border-box;
  float: left;
  height: 25px;
  margin: 10px;
  position: relative;
  width: -moz-calc((100% - 80px) / 4);
  -moz-box-sizing: border-box;
}

#grid > ol > li > button {
  background-color: transparent;
  background-image: url(chrome://ntab/skin/icon/controls.png);
  background-position: 147px 0;
  cursor: pointer;
  border: 0;
  display: none;
  height: 24px;
  position: absolute;
  right: 0;
  top: 0;
  width: 24px;
  -moz-appearance: none;
}
#grid > ol > li > button:first-of-type {
  background-position: 177px 0;
  left: 0;
  right: auto;
}

#grid > ol > li > a {
  color: #3c3c3c;
  text-decoration: none;
}
#grid > ol > li > a > .thumb {
  background: no-repeat white;
  display: block;
  height: 100%;
  width: 100%;
}
#grid > ol > li > a > .title {
  background: #fafafa;
  bottom: 0;
  display: block;
  height: 25px;
  line-height: 25px;
  overflow: hidden;
  position: absolute;
  text-indent: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

#grid > ol > li[draggable="false"] {
  border-style: dashed;
}
#grid > ol > li[draggable="false"] > a > .thumb {
  background: url(chrome://ntab/skin/icon/plus.png) no-repeat center center, url(chrome://ntab/skin/noise.png) repeat rgba(242, 242, 242, 0.49);
}
#grid > ol > li[draggable="false"] > a > .title {
  display: none;
}

#grid > ol > li:hover {
  border-color: #9a9fa4;
  box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.85);
  -moz-box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.85);
}
#grid > ol > li:hover > button {
  display: block;
}
#grid > ol > li > button:hover {
  background-position: 147px 25px;
}
#grid > ol > li > button:first-of-type:hover {
  background-position: 177px 25px;
}

/* customized grid */
#grid.c2 > ol {
  max-width: 580px;
}
#grid.c2 > ol > li {
  width: -moz-calc((100% - 40px) / 2);
}
#grid.c3 > ol {
  max-width: 870px;
}
#grid.c3 > ol > li {
  width: -moz-calc((100% - 60px) / 3);
}
#grid.c5 > ol {
  max-width: 1450px;
}
#grid.c5 > ol > li {
  width: -moz-calc((100% - 100px) / 5);
}
#grid.c6 > ol {
  max-width: 1740px;
}
#grid.c6 > ol > li {
  width: -moz-calc((100% - 120px) / 6);
}


/* quickdial site */
#site > .top-flex {
  height: -moz-calc(50% - 25px - 195px);
}
#site > iframe:nth-of-type(1) {
  border: none;
  height: 370px;
  margin: 0 -moz-calc(50% - 360px);
  width: 720px;
}
#site > iframe:nth-of-type(2) {
  border: none;
  display: none;
  height: 650px;
  margin: 0 -moz-calc(50% - 480px);
  width: 960px;
}

/* footer controls */
footer {
  background: url(chrome://ntab/skin/noise.png) repeat rgba(242, 242, 242, 0.98);
  border-top: 1px #d8d8d8 solid;
  bottom: 0;
  height: 50px;
  padding-top: 12px;
  position: fixed;
  text-align: center;
  width: 100%;
  -moz-box-sizing: padding-box;
  z-index: 1;
}
.nav > footer {
  display: none;
}

/* firefox logo */
footer > a {
  display: block;
  float: left;
  margin: -5px 0 0 40px;
}

/* right aligned toggle & launcher */
#toggle, #launcher {
  float: right;
  margin: 0 34px 0 0;
}
#toggle {
  background: url(chrome://ntab/skin/icon/bottom.png) no-repeat -80px -26px;
  cursor: pointer;
  height: 25px;
  line-height: 25px;
  padding: 0 6px 0 0;
  text-indent: -9999px;
  width: 10px;
}

footer.off {
  background: transparent;
  border-top: none;
}
footer.off > a,
footer.off > #launcher,
.quickdial > footer.off > #quick_dial_tabs {
  display: none;
}
footer.off > #toggle {
  background-position: -80px 4px;
}

/* launcher items */
#launcher > li {
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-block;
  line-height: 25px;
  padding: 0 6px;
  position: relative;
}
#launcher > li[data-menu="tools"]:before,
#launcher > li[data-menu="page-settings"]:before {
  background: url(chrome://ntab/skin/icon/bottom.png);
  background-repeat: no-repeat;
  content: "　";
  display: inline-block;
  width: 16px;
}
#launcher > li[data-menu="tools"]:before {
  background-position: -16px 2px;
}
#launcher > li[data-menu="page-settings"]:before {
  background-position: -46px 2px;
}
#launcher > li:hover,
#launcher.related-tabs > li[data-menu="related-tabs"],
#launcher.tools > li[data-menu="tools"],
#launcher.page-settings > li[data-menu="page-settings"] {
  background: url(chrome://ntab/skin/noise.png) repeat #dedede;
  border: 1px solid #c9ced2;
  border-radius: 3px;
}
#launcher > li[data-menu="tools"]:hover:before,
#launcher.tools > li[data-menu="tools"]:before {
  background-position: -16px -28px;
}
#launcher > li[data-menu="page-settings"]:hover:before,
#launcher.page-settings > li[data-menu="page-settings"]:before {
  background-position: -46px -28px;
}

/* popups of launcher items */
#launcher > li > div,
#launcher > li > ul,
#launcher > li > form {
  background: url(chrome://ntab/skin/noise.png) repeat #fff;
  border: 1px solid #d8d8d8;
  bottom: 30px;
  box-shadow: 0 0 6px 0 #000;
  cursor: default;
  display: none;
  line-height: 28px;
  padding: 12px 5px;
  position: absolute;
  right: 0;
  text-align: left;
  white-space: nowrap;
}
#launcher.related-tabs > li > #related-tabs,
#launcher.tools > li > #tools,
#launcher.page-settings > li > #page-settings {
  display: block;
}

/* related-tabs */
#related-tabs > dl {
  margin-bottom: 10px;
  width: 343px;
}
#related-tabs > dl > dt,
#related-tabs > dl > dd > a {
  overflow: hidden;
  margin: 0 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#related-tabs > dl > dt {
  background: url(chrome://ntab/skin/icon/open_close.png) no-repeat 2px -10px;
  text-indent: 20px;
}
#related-tabs > dl.frequent > dt.frequent,
#related-tabs > dl.session > dt.session {
  background-position: 2px 10px;
}

#related-tabs > dl > dd + dt {
  border-top: 1px solid #d8d8d8;
}

#related-tabs > dl > dd {
  display: none;
  margin-left: 0;
}
#related-tabs > dl.frequent > dt.frequent ~ dd,
#related-tabs > dl.session > dt.session ~ dd {
  display: block;
}
#related-tabs > dl.frequent > dt.session ~ dd {
  display: none;
}

#related-tabs > dl > dd > input,
#related-tabs > dl > dd > a,
#related-tabs > dl > dd > button {
  cursor: pointer;
  vertical-align: middle;
}
#related-tabs > dl > dd > a {
  color: #3c3c3c;
  display: inline-block;
  text-decoration: none;
  width: 296px;
}
#related-tabs > dl > dd > a:hover {
  color: #3c3c3c;
  text-decoration: underline;
}
#related-tabs > dl > dd > button {
  background-color: transparent;
  background-image: url(chrome://ntab/skin/icon/remove.png);
  background-repeat: no-repeat;
  border: 0;
  height: 20px;
  width: 20px;
  -moz-appearance: none;
}
#related-tabs > dl > dd > button:hover {
  background-position: 0 -20px;
}
#related-tabs > label + input {
  margin-left: 24px;
}

/* tools, like about:home */
#tools > li {
  background: url(chrome://ntab/skin/icon/tools.png) no-repeat, url(chrome://ntab/skin/noise.png) repeat #fff;
  cursor: pointer;
  list-style: none;
  padding: 0 5px 0 34px;
}
#tools > li[id="downloads"] {
  background-position: 3px -2px;
}
#tools > li[id="bookmarks"] {
  background-position: 3px -122px;
}
#tools > li[id="history"] {
  background-position: 3px -62px;
}
#tools > li[id="addons"] {
  background-position: 3px -32px;
}
#tools > li[id="sync"] {
  background-position: 3px -152px;
}
#tools > li[id="settings"] {
  background-position: 3px -92px;
}
#tools > li:hover {
  background-color: #f2f2f2;
}

/* page-settings */

#page-settings > fieldset {
  border: none;
  border-top: 1px solid #d8d8d8;
  margin: 7px 14px;
}
#page-settings > fieldset > div > input + input,
#page-settings > fieldset > div > label + input,
#page-settings > fieldset > div > label + label,
#page-settings > fieldset > div > select + label {
  margin-left: 8px;
}

#bgcolor-radio > label {
  border: 1px solid #d8d8d8;
  cursor: pointer;
  display: inline-block;
  height: 22px;
  text-indent: -9999px;
  width: 22px;
}
#bgcolor-radio > label:nth-of-type(1) {
  background: white;
}
#bgcolor-radio > label:nth-of-type(2) {
  background: #fff8ed;
}
#bgcolor-radio > label:nth-of-type(3) {
  background: #fdfece;
}
#bgcolor-radio > label:nth-of-type(4) {
  background: #edfffb;
}
#bgcolor-radio > label:nth-of-type(5) {
  background: #edf7ff;
}
#bgcolor-radio > label:nth-of-type(6) {
  background: #f4edff;
}
#bgcolor-radio > label:nth-of-type(7) {
  border: none;
  cursor: auto;
  text-indent: 0;
}
#bgcolor-radio > label > input[name='bgcolor'] {
  display: none;
}
#page-settings input,
#page-settings label,
#page-settings select {
  cursor: pointer;
}

/* another quickdial tab switcher */
#quick_dial_tabs {
  display: none;
  margin: auto;
  width: 216px;
}
.quickdial > footer > #quick_dial_tabs {
  display: block;
}

#quick_dial_tabs > a {
  border-top: 5px solid #d6d6d6;
  cursor: pointer;
  display: inline-block;
  padding-top: 1px;
  width: 104px;
}
#quick_dial_tabs.grid > a[data-tab="grid"],
#quick_dial_tabs.site > a[data-tab="site"] {
  border-top-color: #b5d9f5;
}

/* add/edit overlay */
#overlay {
  background: rgba(25, 25, 25, 0.5);
  left: 0;
  top: 0;
  position: absolute;
}
#overlay > div {
  background: url(chrome://ntab/skin/noise.png) white;
  box-shadow: 0 0 6px 0 #000;
  height: 366px;
  margin: 100px auto 0;
  padding: 12px 8px;
  width: 704px;
}

#dial_editor > input {
  width: 44%;
}
#dial_editor > input[type="submit"] {
  width: 7%;
}

#editor_tabs {
  background: white;
  border: 1px solid #dfdfdf;
  height: 32px;
  margin: 10px 0 0;
  padding: 5px 5px 0;
}
#editor_tabs > li {
  background: #eee;
  border: 1px solid #dfdfdf;
  display: inline-block;
  line-height: 28px;
  margin: 2px 1px 0;
  padding: 1px 4px 0;
  text-align: center;
  width: 85px;
}
#editor_tabs.editor_related > li[data-tab="editor_related"],
#editor_tabs.editor_bookmark > li[data-tab="editor_bookmark"],
#editor_tabs.editor_promoted > li[data-tab="editor_promoted"] {
  background: white;
  border-bottom: 1px solid white;
}

#editor_tabpanels {
  background: white;
  border: 1px solid #dfdfdf;
  border-top: none;
  box-shadow: inset 0 0 0 2px white;
  height: 290px;
  overflow: auto;
  -moz-box-shadow: inset 0 0 0 2px white;
}
#editor_tabpanels > div,
#editor_tabpanels > ul,
#editor_tabpanels > iframe {
  display: none;
}
#editor_tabs.editor_related + #editor_tabpanels > #editor_related,
#editor_tabs.editor_bookmark + #editor_tabpanels > #editor_bookmark,
#editor_tabs.editor_promoted + #editor_tabpanels > #editor_promoted {
  display: block;
}

#editor_related > figure {
  display: inline-block;
  height: 277px;
  margin: 0;
  padding: 5px 20px;
  vertical-align: text-top;
  width: -moz-calc(49% - 2 * 20px);
}
#editor_related > figure > figcaption {
  padding-bottom: 5px;
  border-bottom: 1px solid #dfdfdf;
  font-weight: bold;
}
#editor_related > figure + figure {
  border-left: 1px solid #dfdfdf;
}
#editor_related > figure > ul {
  margin-top: 5px;
}
#editor_related > figure > ul > li,
#editor_bookmark > li {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

#editor_bookmark {
  margin: 5px 20px;
}
#editor_bookmark > li {
  width: 49%;
}
#editor_related > figure > ul > li > a,
#editor_related > figure > ul > li > a:visited,
#editor_bookmark > li > a,
#editor_bookmark > li > a:visited {
  background-repeat: no-repeat;
  background-position: 0 3px;
  background-size: 16px;
  color: #3c3c3c;
  display: inline-block;
  line-height: 20px;
  max-width: 100%;
  overflow: hidden;
  text-decoration: none;
  text-indent: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editor_promoted {
  border: none;
  height: 100%;
  width: 702px;
}
#prompt-close {
  background: url(chrome://ntab/skin/icon/close.png) no-repeat -9px -3px transparent;
  border-radius: 14px;
  cursor: pointer;
  display: inline-block;
  height: 28px;
  left: 700px;
  position: relative;
  top: -389px;
  width: 28px;
  -moz-border-radius: 14px;
}
#prompt-close:hover {
  background-position: -9px -43px;
}

/* responsive */
@media only screen and (max-width: 960px) {
  #setdefault {
    left: 70px;
  }
  #navpane {
    right: 70px;
  }
  /* #prevtab, #nexttab ... not needed with min-width on body */
}
@media only screen and (min-width: 1920px) {
  #setdefault {
    left: 120px;
  }
  #navpane {
    right: 120px;
  }

  #prevtab,
  #nexttab {
    width: 100px;
  }
  #quick_dial_tabpanels {
    width: -moz-calc(100% - 200px);
  }
}

@media only screen and (min-height: 850px) and (min-width: 1440px) {
  #site > .top-flex {
    height: -moz-calc(50% - 25px - 325px + 45px - 10px);
  }
  #site > iframe:nth-of-type(1) {
    display: none;
  }
  #site > iframe:nth-of-type(2) {
    display: block;
  }
}
